package com.zijin.Dao;

import com.zijin.entity.Answer;
import com.zijin.entity.Question;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface QuestionMapper {
    @Insert("insert into question(qid,content,id,time,qstatus) values (#{qid},#{content},#{id},#{time},#{qstatus})")
    Integer insertQuestion(Question question);
    @Select("select content from question where id=#{id}")
    List<Question> selectQuestionById(Integer id);
    @Select("select qstatus from question where qid=#{qid}")
    Question selectQuestionByQid(Integer qid);
    @Select("select qid,content from question where qstatus=#{qstatus}")
    List<Question> selectQuestionByQstatus(Integer qstatus);
    @Select("select question.qid,question.content,answer.acontent from question,answer where question.qid=answer.aqid")
    List<Question> selectQuestionByQidAndAnswer(Integer qid);

}
